#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
using namespace std;
long long n,l[1000005],r[1000005],i,s,q,m[1000005],j;
struct ooo
{
	long long x;
	long long y;
	long long z;
}a[80005];
bool cmp(ooo aa,ooo bb)
{
	return aa.x<bb.x;
}
bool cmp2(ooo aa,ooo bb)
{
	return aa.y<bb.y;
}
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
    cin>>n>>q;
    for(i=1;i<=n;i++)
    {
    	cin>>a[i].x;
    	a[i].y=i;
	}
	sort(a+1,a+n+1,cmp);
	for(i=1;i<=n;i++)
	{
		a[i].z=i;
	}
	sort(a+1,a+n+1,cmp2);
	for(i=1;i<=q;i++)
	{
		cin>>m[i];
		if(m[i]==1)
		cin>>l[i]>>r[i];
		else
		cin>>l[i];
	}
	for(i=1;i<=q;i++)
	{
		if(m[i]==1)
		{
			a[l[i]].x=r[i];
			if(m[i+1]==2)
			{
			for(j=1;j<=n;j++)
			{
				a[j].y=j;
			}
			sort(a+1,a+n+1,cmp);
			for(j=1;j<=n;j++)
			{
				a[j].z=j;
			}
			sort(a+1,a+n+1,cmp2);
			}
		}
		else
		{
			cout<<a[l[i]].z<<endl;
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
 }






